home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / mfc simpleplayer.win / simpleplayermfcdoc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  2.3 KB  |  101 lines

  1. // SimplePlayer MFCDoc.cpp : implementation of the CSimplePlayerMFCDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SimplePlayerMFC.h"
  6.  
  7. #include "SimplePlayerMFCDoc.h"
  8. #include "SimplePlayerMFCView.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CSimplePlayerMFCDoc
  18.  
  19. IMPLEMENT_DYNCREATE(CSimplePlayerMFCDoc, CDocument)
  20.  
  21. BEGIN_MESSAGE_MAP(CSimplePlayerMFCDoc, CDocument)
  22.     //{{AFX_MSG_MAP(CSimplePlayerMFCDoc)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CSimplePlayerMFCDoc construction/destruction
  30.  
  31. CSimplePlayerMFCDoc::CSimplePlayerMFCDoc()
  32. {
  33.     // TODO: add one-time construction code here
  34.  
  35. }
  36.  
  37. CSimplePlayerMFCDoc::~CSimplePlayerMFCDoc()
  38. {
  39. }
  40.  
  41. BOOL CSimplePlayerMFCDoc::OnNewDocument()
  42. {
  43.     if (!CDocument::OnNewDocument())
  44.         return FALSE;
  45.  
  46.     // TODO: add reinitialization code here
  47.     // (SDI documents will reuse this document)
  48.  
  49.     return TRUE;
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CSimplePlayerMFCDoc serialization
  54.  
  55. void CSimplePlayerMFCDoc::Serialize(CArchive& ar)
  56. {
  57.     if (ar.IsStoring())
  58.     {
  59.         // TODO: add storing code here
  60.     }
  61.     else
  62.     {
  63.         // TODO: add loading code here
  64.     }
  65. }
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CSimplePlayerMFCDoc diagnostics
  69.  
  70. #ifdef _DEBUG
  71. void CSimplePlayerMFCDoc::AssertValid() const
  72. {
  73.     CDocument::AssertValid();
  74. }
  75.  
  76. void CSimplePlayerMFCDoc::Dump(CDumpContext& dc) const
  77. {
  78.     CDocument::Dump(dc);
  79. }
  80. #endif //_DEBUG
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CSimplePlayerMFCDoc commands
  84.  
  85. BOOL CSimplePlayerMFCDoc::OnOpenDocument(LPCTSTR lpszPathName) 
  86. {
  87.     if (!CDocument::OnOpenDocument(lpszPathName))
  88.         return FALSE;
  89.     
  90.     // Set the Movie filename for the view
  91.     POSITION pos = GetFirstViewPosition();
  92.     CSimplePlayerMFCView* pView = (CSimplePlayerMFCView*)GetNextView(pos);
  93.     if (pView){
  94.         pView->mfullPath = lpszPathName;
  95.         if (pView->OpenMovie() != TRUE)
  96.             return FALSE;
  97.     }
  98.     
  99.     return TRUE;
  100. }
  101.